home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / U-Z / VideoToolBox Folder / Utilities / Quick3 / MyFgets.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-23  |  481 b   |  22 lines  |  [TEXT/KAHL]

  1. /*
  2. MyFgets.c
  3.  
  4. A version of fgets() that, like gets(), strips the trailing '\n'.
  5. Please DON'T use this. It was a BAD idea.
  6.  
  7. HISTORY:
  8. god knows when dgp wrote it.
  9. 12/1/92    dgp fixed stupid error of deleting last character without first
  10.             making sure that it's an '\n'
  11. */
  12. #include "VideoToolbox.h"
  13.  
  14. char *MyFgets(char *s, int length, FILE *stream)
  15. {
  16.     int i;
  17.     
  18.     fgets(s,length,stream);
  19.     i=strlen(s);
  20.     if(i>0 && i<length && s[i-1]=='\n') s[i-1]=0;    /* strip trailing "\n" */
  21.     return s;
  22. }